/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package qq;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.Socket;
import java.util.HashMap;
import java.util.Iterator;

/**
 *
 * @author castle
 */
public class ClientReceiveThread extends Thread{
    private Socket socket;
    public QQMain qq;
    public ClientReceiveThread(Socket s,QQMain main){
        this.socket=s;
        this.qq=main;
    }
    public void run(){
        try {
            
        InputStream inputStream = socket.getInputStream();
        // 得到一个输入流，接收客户端传递的信息
        InputStreamReader inputStreamReader = new InputStreamReader(
                inputStream);// 提高效率，将自己字节流转为字符流
        BufferedReader bufferedReader = new BufferedReader(
                inputStreamReader);// 加入缓冲区
        String temp = null;
        String info = "";
        while ((temp = bufferedReader.readLine()) != null) {
            info += temp;
            System.err.println(info);
            this.qq.jTextArea1.append(info);
        }
        } catch (Exception e) {
        }
    }
}
